package com.irdstudio.bsp.console.api.rest;

import java.util.List;

import com.irdstudio.bsp.console.service.vo.BpmNodeInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.irdstudio.bsp.console.service.facade.BpmNodeInfoService;
import com.irdstudio.sdk.beans.core.vo.ResponseData;
import com.irdstudio.sdk.ssm.web.AbstractController;

@RestController
@RequestMapping("/api")
public class BpmNodeInfoController extends AbstractController  {
	
	@Autowired
	@Qualifier("bpmNodeInfoServiceImpl")
	private BpmNodeInfoService bpmNodeInfoService;

	
	/**
	 * 列表数据查询
	 * @param page
	 * @param size
	 * @return
	 */
	@RequestMapping(value="/bpm/node/infos", method=RequestMethod.POST)
	public @ResponseBody ResponseData<List<BpmNodeInfoVO>> queryBpmNodeInfoAll(
			BpmNodeInfoVO vo) {		
		List<BpmNodeInfoVO> outputVo = bpmNodeInfoService.queryAllOwner(vo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键查询详情
	 * @return
	 */
	@RequestMapping(value="/bpm/node/info/{bpmNodeId}", method=RequestMethod.GET)
	public @ResponseBody ResponseData<BpmNodeInfoVO> queryByPk(@PathVariable("bpmNodeId") String bpmNodeId) {		
		BpmNodeInfoVO inVo = new BpmNodeInfoVO();
				inVo.setBpmNodeId(bpmNodeId);
		BpmNodeInfoVO outputVo = bpmNodeInfoService.queryByPk(inVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键删除信息
	 * @param bpmNodeInfo
	 * @return
	 */
	@RequestMapping(value="/bpm/node/info", method=RequestMethod.DELETE)
	public @ResponseBody ResponseData<Integer> deleteByPk(@RequestBody BpmNodeInfoVO inBpmNodeInfoVo) {		
		int outputVo = bpmNodeInfoService.deleteByPk(inBpmNodeInfoVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键更新信息
	 * @param inBpmNodeInfoVo
	 * @return
	 */
	@RequestMapping(value="/bpm/node/info", method=RequestMethod.PUT)
	public @ResponseBody ResponseData<Integer> updateByPk(@RequestBody BpmNodeInfoVO inBpmNodeInfoVo) {		
		int outputVo = bpmNodeInfoService.updateByPk(inBpmNodeInfoVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 新增数据
	 * @param inBpmNodeInfoVo
	 * @return
	 */
	@RequestMapping(value="/bpm/node/info", method=RequestMethod.POST)
	public @ResponseBody ResponseData<Integer> insertBpmNodeInfo(@RequestBody BpmNodeInfoVO inBpmNodeInfoVo) {
		int outputVo = bpmNodeInfoService.insertBpmNodeInfo(inBpmNodeInfoVo);
		return getResponseData(outputVo);
		
	}
}
